home *** CD-ROM | disk | FTP | other *** search
- #include <conio.h>
- #include <stdlib.h>
-
- #include "quicky.hpp"
- #include "xcbitmap.h"
- #include "xlib_all.h"
-
- const ushort w=24;
- const ushort h=24;
- const ushort cbms=60;
-
- char bitmap[w*h+2];
-
- char cbm[1024*128];
-
-
- void main(void)
- {
- x_set_mode(X_MODE_320x240,320);
- x_set_doublebuffer(240);
-
- bitmap[0]=w;
- bitmap[1]=h;
- for( ushort a=0;a<h;a++ )
- for( ushort b=0;b<w;b++ )
- *(bitmap+2+(a*h)+b)=(a>h/3 && a<2*h/3 && b>w/3 && b<2*w/3)?0:a^b+16;
-
- ulong ul1, ul2;
- ul1=x_sizeof_cbitmap(320/4,bitmap);
- ul2=x_compile_bitmap(320/4,bitmap,cbm);
-
-
- ushort x[cbms];
- ushort y[cbms];
- ushort vx[cbms];
- ushort vy[cbms];
-
- for( ushort u=0;u<cbms;u++ )
- {
- x[u]=rand()%(ScrnPhysicalPixelWidth-w);
- y[u]=rand()%(ScrnPhysicalHeight-h);
- vx[u]=rand()%5 -2;
- vy[u]=rand()%5 -2;
- }
-
-
- while( !kbhit() )
- {
- x_rect_fill(0,0,ScrnLogicalPixelWidth-1,ScrnLogicalHeight-1,HiddenPageOffs,0);
- for( u=0;u<cbms;u++ )
- {
- x_put_cbitmap(x[u],y[u],HiddenPageOffs,cbm);
- x[u]+=vx[u];
- y[u]+=vy[u];
- if( x[u]<0 || x[u]>=ScrnPhysicalPixelWidth-w )
- {
- vx[u]*=-1;
- x[u]+=vx[u];
- }
- if( y[u]<0 || y[u]>=ScrnPhysicalHeight-h )
- {
- vy[u]*=-1;
- y[u]+=vy[u];
- }
- }
-
- x_page_flip(0,0);
- }
-
- getch();
-
- x_text_mode();
- }
-